<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018\9\11 0011
 * Time: 17:05
 */

namespace app\validate;


use think\Validate;

class AdminMenuValidate extends Validate
{
    protected $rule=[
        'id'                        =>'require|number',
        'name'                      =>'require',
        'project'                   =>'require',
        'c'                         =>'require',
        'a'                         =>'require',
        'parent_id'                 =>'require|number',
        'level'                     =>'require|number',
        'sort_no'                   =>'number',
        'show_menu'                 =>'require|in:0,1',
        'status'                    =>'require|in:0,1',
        'create_uid'                =>'require|number',
        'create_time'               =>'require|number',
        'save_uid'                  =>'require|number',
        'save_time'                 =>'require|number',
    ];
    protected $message=[
        'id.require'                =>'id标识必须',
        'id.number'                 =>'id标识必须为数字',
        'name.require'              =>'菜单名称必须',
        'project.require'           =>'项目模块必须',
        'c.require'                 =>'控制器标识必须',
        'a.require'                 =>'方法标识必须',
        'parent_id.require'         =>'上级必须选择',
        'parent_id.number'          =>'上级参数必须为数字',
        'level.require'             =>'菜单等级获取失败',
        'level.number'              =>'菜单等级获取失败',
        'sort_no.number'            =>'菜单排序只能为数字',
        'show_menu.require'         =>'菜单是否显示必须选择',
        'show_menu.in:0,1'          =>'菜单是否显示获取失败',
        'status.require'            =>'菜单状态获取失败',
        'status.in:0,1'             =>'菜单状态获取失败',
        'create_uid.require'        =>'操作用户数据获取失败',
        'create_uid.number'         =>'操作用户数据获取失败',
        'create_time.require'       =>'操作时间获取失败',
        'create_time.number'        =>'操作时间获取失败',
        'save_uid.require'          =>'操作用户数据获取失败',
        'save_uid.number'           =>'操作用户数据获取失败',
        'save_time.require'         =>'操作时间获取失败',
        'save_time.number'          =>'操作时间获取失败',
    ];
    protected $scene =[
        'add'=>[
            'name',
            'project',
            'c',
            'a',
            'parent_id',
            'level',
            'sort_no',
            'show_menu',
            'status',
            'create_uid',
            'create_time',
        ],
        'save'=>[
            'id',
            'name',
            'project',
            'c',
            'a',
            'parent_id',
            'level',
            'sort_no',
            'show_menu',
            'status',
            'save_uid',
            'save_time',
        ],
    ];
}